package com.CampusLife.until;
import	java.io.IOException;

import java.io.File;

/**
 * 删除用户上传图片
 *
 */
public class DeleteImages {
       public  void deleteDirectory(File  imgUrl) throws IOException {
           File file = new File("D:\\Life\\Campus-Life\\src\\main\\webapp\\WEB-INF"+imgUrl);
            if (file.isFile()) {
                file.delete();
            } else {
                // 首先得到当前的路径
                String[] childFilePaths = file.list();
                for (String childFilePath : childFilePaths) {
                    File childFile = new File(file.getAbsolutePath() + "/" + childFilePath);
                    deleteDirectory(childFile);
                }
                file.delete();
            }
        }

    }


